<template>
  <div class="educational">
    <van-collapse accordion v-model="activeNames" :border="false" @change="activeChild">
      <van-collapse-item name="1">
        <template #title>
          <span>
            教育经历
            <!-- <van-icon name="question-o" /> -->
          </span>
          <a href="javascript:;" class="edcatadd" @click="educationadd()">添加</a>
        </template>
        <div v-for="(item,index) in eduInfoOutVos" :key="index+'eduInfoOutVos'">
          <div class="edycatimove">
            <span class="educationalchild">
              {{item.school}}
              <!-- <van-icon name="question-o" /> -->
            </span>
            <a href="javascript:;" class="edcatadd" @click="remove(item)">编辑</a>
          </div>
          <div style=" text-align: left">
            <p class="educationalchildPC">{{item.startTime}}~{{item.endTime}}</p>
            <p class="educationalchildPC">
              {{item.educationText}}
              <span class="zwfg">|</span>
              {{item.major}}
            </p>
          </div>
          <van-divider color="#E8E8E8" />
        </div>
      </van-collapse-item>
    </van-collapse>

    <div :style="{height:height}">
      <div>
        <!-- <van-collapse
          accordion
          v-show="finished"
          v-for="item,index in eduInfoOutVos"
          :key="index+'eduInfoOutVos'"
          v-model="activeNameschild"
          :border="false"
          @change="change"
        >
          <van-collapse-item name="2">
            <template #title>
              <span class="educationalchild">
                {{item.school}}

              </span>
              <a href="javascript:;" class="edcatadd">编辑</a>
            </template>
          </van-collapse-item>
        </van-collapse>-->
      </div>
    </div>
  </div>
</template>
<script>
export default {
  data () {
    return {
      activeNames: [],
      activeNameschild: [],
      finished: false,
      resumeid: '',
      eduInfoOutVos: [],
      height: ''
    }
  },
  computed: {},
  methods: {
    activeChild () {
      this.finished = !this.finished
    },
    resumeidjy (resumeid, eduInfoOutVos) {
      this.resumeid = resumeid
      if (eduInfoOutVos) {
        this.eduInfoOutVos = eduInfoOutVos
        for (let i = 0; i < this.eduInfoOutVos.length; i++) {
          this.eduInfoOutVos[i].startTime = /\d{4}-\d{1,2}-\d{1,2}/g
            .exec(this.eduInfoOutVos[i].startTime)
            .toString()
          this.eduInfoOutVos[i].endTime = /\d{4}-\d{1,2}-\d{1,2}/g
            .exec(this.eduInfoOutVos[i].endTime)
            .toString()
        }
      }

      console.log('resumeid', resumeid)
    },
    change (name) {
      console.log(name === '')
      if (name === '') {
        this.height = ''
      } else {
        console.log(1)
        let hetg = this.eduInfoOutVos.length * 1.4
        this.height = hetg
      }
      this.$forceUpdate()
    },
    remove (item) {
      console.log(item, 'item')
      sessionStorage.setItem('educationadd', JSON.stringify(item))
      this.$router.push({
        name: 'educationadd',
        query: {
          resumeid: this.resumeid,
          id: 1
        }
      })
    },
    educationadd () {
      if (this.resumeid === '') {
        this.$notify('请先提交个人信息')
        return false
      }
      this.$router.push({
        name: 'educationadd',
        query: {
          resumeid: this.resumeid
        }
      })
    }
  },
  created () { }
}
</script>
<style scoped></style>
